package base;

import java.io.FileNotFoundException;
import java.io.IOException;

import javax.swing.JOptionPane;

import util.Config;

public class AppMemory {
	private static Config config;

	public static Config getConfig() {
		return config;
	}

	public static void setConfig(Config configuration) {
		config = configuration;
	}
	
	public static boolean loadConfig() {
		Config config;
		try {
			config = new Config("config.ini");
			setConfig(config);
			return true;
		} catch (FileNotFoundException e) {
//			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "Fehler beim Laden der config.ini: " + e.getMessage(), "FileNotFoundException",
					JOptionPane.ERROR_MESSAGE);
		} catch (IOException e) {
//			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "Fehler beim Laden der config.ini: " + e.getMessage(), "IOException",
					JOptionPane.ERROR_MESSAGE);
		}
		return false;
	}
	
}
